import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'home',
    component:(()=>import("../views/Home.vue")),
    children:[
      {
        path: '/home/class',
        name: 'class',
        component:(()=>import("../views/Class.vue"))
      },
      {
        path: '/home/shop',
        name: 'shop',
        component:(()=>import("../views/Shop.vue"))
      },
      {
        path: '/home/gong',
        name: 'gong',
        component:(()=>import("../views/Gong.vue"))
      },
      {
        path: '/home/vip',
        name: 'vip',
        component:(()=>import("../views/Vip.vue"))
      },
      {
        path: '/home/my',
        name: 'my',
        component:(()=>import("../views/My.vue"))
      },
      {
        path:"/home",
        redirect: '/home/class',  // 重定向:重新指向其它path,会改变网址
      }
    ]
  },
  {
    path:"/",
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
